package name.matthewgreet.example9.form; import java.util.Date; import com.opensymphony.xwork2.TextProvider; import com.opensymphony.xwork2.interceptor.ValidationAware; import name.matthewgreet.example9.util.DOBRangeValidator; import name.matthewgreet.strutscommons.annotation.CustomPostConversion; import name.matthewgreet.strutscommons.annotation.DateConversion; import name.matthewgreet.strutscommons.form.AbstractFormattableForm; @SuppressWarnings("deprecation") public class DateOfBirthAutoConversionForm extends AbstractFormattableForm { private static final long serialVersionUID = 4546633634493518786L; @DateConversion(message = "The date of birth must be in the form dd/mm/yyyy", format = "dd/MM/yyyy") @CustomPostConversion(param1 = "15", param2 = "150", validatorClass = DOBRangeValidator.class) private Date dateOfBirth; public DateOfBirthAutoConversionForm() { resetFields(); } @Override public void resetFields() { dateOfBirth = null; } @Override public void doValidate(ValidationAware validationAware, TextProvider textProvider) { // Empty } public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } }